package com.example.demo9;

import android.content.IntentFilter;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import com.example.demo9.broadcastreceiver.YourReceiver;

public class MainActivity extends AppCompatActivity {
    private IntentFilter intentFilter;
    private YourReceiver yourReceiver;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //注册广播接收器
        intentFilter=new IntentFilter();
        intentFilter.addAction("com.example.demo8.XINGE");
        //设置优先级
        intentFilter.setPriority(100);
        yourReceiver=new YourReceiver();
        registerReceiver(yourReceiver,intentFilter);
    }
}
